﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Web.Framework;
using Ubatic.Contracts.Services;
using Ubatic.ServiceFactory;

namespace Ubatic.UI.Account
{
    public partial class EmailVerificado : BasePage
    {
        private IUserService UserService = Factory.GetUserService();

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
            }
            catch (Exception ex)
            {
                ExceptionManager.Instance.HandleException(ex);
            }
        }

        protected void btnConfirmar_Click(object sender, EventArgs e)
        {
            try
            {
                if (UserService.ConfirmarEmail(this.Request.QueryString["v"], this.txtPassword.Text))
                {
                    this.masterPage.ShowMessage("Su correo ha sido verificado", WebMessageType.Notification);
                }
                else
                {
                    this.masterPage.ShowMessage("Su usuario NO ha sido autorizado para ingresar al sistema", WebMessageType.Notification);
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Instance.HandleException(ex);
            }
        }
    }
}